/*******************************************************************
 * 外语翻译平台(translate) 
 *
 * 成都一亿信息技术公司 版权所有
 * 
 * Copyright (C) 2010 Transer Information Technology Co., Ltd.
 *
 * @Version : 1.0  2011-1-28 上午11:19:23
 *
 * UserRegisteAction.java
 *
 *******************************************************************/
package com.transer.web.action.signup;

import com.opensymphony.xwork2.ActionSupport;
import com.transer.console.ConsoleConstants;
import com.transer.job.AddUserJob;
import com.transer.utils.JobQueueOB;
import com.transer.utils.MD5;

/**
 * class defination are there
 * 
 * @author Mark
 * 
 * @version 1.0 ywengineer@gmail.com
 * 
 */
public class UserRegisteAction extends RegisteAction {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8248828928810435610L;

	/*
	 * (non-Javadoc)
	 * 
	 * @see com.transer.web.action.signup.RegisteAction#execute()
	 */
	@Override
	public String execute() throws Exception {
		super.execute();
		// 存在验证错误
		if (hasFieldErrors()) {
			return ActionSupport.INPUT;
		}
		// 加密
		user.setPassword(MD5.getMD5(user.getPassword()));
		// 添加发送邮件
		JobQueueOB.getInstance().addJob(ConsoleConstants.QUEUE_INDEX_SAVE_USER, new AddUserJob(userDao, user));
		// 注册成功
		return ActionSupport.SUCCESS;
	}
}
